﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace UnknowWorld.CardGame
{
    /// <summary>
    /// 敌人模型
    /// </summary>
    public class EnemyModel : MonoBehaviour
    {
        void Start()
        {

        }

        void Update()
        {

        }

        #region Data
        /// <summary>
        /// 图片位置
        /// </summary>
        public SpriteRenderer dataSpriteRenderer;

        /// <summary>
        /// 敌人数据
        /// </summary>
        public Enemey Enemey
        {
            get { return _enemey; }
        }

        /// <summary>
        /// 敌人数据
        /// </summary>
        private Enemey _enemey;

        /// <summary>
        /// 绑定敌人数据
        /// </summary>
        /// <param name="card"></param>
        public void BindData(Enemey enemey)
        {
            _enemey = enemey;
            EnemyPool.Instance.LoadEnemyPictureSprite(enemey, (sprite) =>
            {
                dataSpriteRenderer.sprite = sprite;
            });
            _enemey.OnHurt += OnHurt;
        }

        /// <summary>
        /// 受到伤害量
        /// </summary>
        /// <param name="value"></param>
        void OnHurt(int value)
        {
            Debug.Log("Enemy hurt!");
        }

        #endregion
        
    }
}